@let empty = !(dataProvider.currentPageCount$ | async) && !(dataProvider.isLoading$ | async);

<ix-page-header>
  <ix-search-input1
    [value]="filterString"
    [disabled]="empty"
    (search)="onListFiltered($event)"
  ></ix-search-input1>

  <ix-table-columns-selector
    [columnPreferencesKey]="'rsyncList'"
    [columns]="columns"
    (columnsChange)="columnsChange($event)"
  ></ix-table-columns-selector>

  <button
    *ixRequiresRoles="requiredRoles"
    mat-button
    color="primary"
    ixTest="add-task"
    [ixUiSearch]="searchableElements.elements.add"
    (click)="add()"
  >
    {{ 'Add' | translate }}
  </button>
</ix-page-header>

@if (empty) {
  <ix-empty [conf]="emptyConfig"></ix-empty>
} @else {
  <ix-table
    class="table"
    [ixUiSearch]="searchableElements.elements.tasks"
    [ix-table-empty]="!(dataProvider.currentPageCount$ | async)"
    [emptyConfig]="emptyService.defaultEmptyConfig(dataProvider.emptyType$ | async)"
  >
    <thead
      ix-table-head
      [columns]="columns"
      [dataProvider]="dataProvider"
    ></thead>
    <tbody
      ix-table-body
      [columns]="columns"
      [dataProvider]="dataProvider"
      [isLoading]="!!(dataProvider.isLoading$ | async)"
    >
    </tbody>
  </ix-table>

  <ix-table-pager [dataProvider]="dataProvider"></ix-table-pager>
}
